<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAkbusPersonnelDriverTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('akbus_personnel_driver', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->tinyInteger('team_num')->nullable()->comment('车队编号');
            $table->tinyInteger('line_num')->nullable()->comment('线路编号');
            $table->tinyInteger('is_join_tu')->nullable()->comment('是否加入公会');
            $table->decimal('tu_amount', 10, 2)->nullable()->comment('会费');
            $table->string('driving_license_url')->nullable()->comment('驾驶证');
            $table->date('driving_license_expire_at')->nullable()->comment('驾驶证到期时间');
            $table->string('work_license_url')->nullable()->comment('从业资格证');
            $table->date('work_license_expire_at')->nullable()->comment('从业资格证到期时间');
            $table->string('bank_card_number')->nullable()->comment('银行卡号');
            $table->string('bank')->nullable()->comment('开户行');

            $table->unsignedBigInteger('personnel_id')->comment('人员ID');
            $table->foreign('personnel_id')->references('id')->on('akbus_personnel')->onDelete('cascade');

            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('akbus_personnel_driver');
    }
}
